home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / BrickoidDemo / BrickoidDemoGeneric.jar / arka / Displayable1.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-09-10  |  2.5 KB  |  66 lines

  1. package arka;
  2.  
  3. import java.io.IOException;
  4. import javax.microedition.lcdui.Canvas;
  5. import javax.microedition.lcdui.Command;
  6. import javax.microedition.lcdui.Displayable;
  7. import javax.microedition.lcdui.Graphics;
  8. import javax.microedition.lcdui.Image;
  9.  
  10. public class Displayable1 extends Canvas {
  11.    Image background;
  12.    Image contin;
  13.    boolean contini = false;
  14.    Command quit = new Command("Quit", 6, 1);
  15.    Command continu = new Command("Continue", 8, 1);
  16.  
  17.    public Displayable1() {
  18.       ((Displayable)this).setCommandListener(new 1(this));
  19.  
  20.       try {
  21.          this.jbInit();
  22.       } catch (Exception e) {
  23.          ((Throwable)e).printStackTrace();
  24.       }
  25.  
  26.    }
  27.  
  28.    private void jbInit() throws Exception {
  29.       try {
  30.          this.background = Image.createImage("/arka/titl.png");
  31.          this.contin = Image.createImage("/arka/continge.png");
  32.       } catch (IOException e) {
  33.          System.out.println(((Throwable)e).getMessage());
  34.       }
  35.  
  36.       ((Displayable)this).addCommand(this.quit);
  37.       ((Displayable)this).addCommand(this.continu);
  38.    }
  39.  
  40.    public void this_commandPerformed(Command c, Displayable d) {
  41.       if (c.getCommandType() == 6) {
  42.          MIDlet1.quitApp();
  43.       }
  44.  
  45.       if (c.getCommandType() == 8) {
  46.          this.contini = true;
  47.          ((Displayable)this).removeCommand(this.continu);
  48.          ((Displayable)this).addCommand(new Command("Play", 4, 1));
  49.          ((Canvas)this).repaint();
  50.       }
  51.  
  52.       if (c.getCommandType() == 4) {
  53.          MIDlet1.startGame();
  54.       }
  55.  
  56.    }
  57.  
  58.    protected void paint(Graphics g) {
  59.       g.drawImage(this.background, 0, 0, 20);
  60.       if (this.contini) {
  61.          g.drawImage(this.contin, 17, 11, 20);
  62.       }
  63.  
  64.    }
  65. }
  66.